<?php

/**
 * Bug form base class.
 *
 * @package    form
 * @subpackage bug
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BaseBugForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'           => new sfWidgetFormInputHidden(),
      'summary'      => new sfWidgetFormInput(),
      'description'  => new sfWidgetFormTextarea(),
      'type_id'      => new sfWidgetFormDoctrineSelect(array('model' => 'BugType', 'add_empty' => true)),
      'milestone_id' => new sfWidgetFormDoctrineSelect(array('model' => 'BugMilestone', 'add_empty' => true)),
      'project_id'   => new sfWidgetFormDoctrineSelect(array('model' => 'Project', 'add_empty' => false)),
      'creator_id'   => new sfWidgetFormDoctrineSelect(array('model' => 'User', 'add_empty' => true)),
      'owner_id'     => new sfWidgetFormDoctrineSelect(array('model' => 'User', 'add_empty' => true)),
      'due_date'     => new sfWidgetFormDate(),
      'priority_id'  => new sfWidgetFormDoctrineSelect(array('model' => 'BugPriority', 'add_empty' => true)),
      'status_id'    => new sfWidgetFormDoctrineSelect(array('model' => 'BugStatus', 'add_empty' => true)),
      'created_at'   => new sfWidgetFormDateTime(),
      'updated_at'   => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'           => new sfValidatorDoctrineChoice(array('model' => 'Bug', 'column' => 'id', 'required' => false)),
      'summary'      => new sfValidatorString(array('max_length' => 255)),
      'description'  => new sfValidatorString(array('required' => false)),
      'type_id'      => new sfValidatorDoctrineChoice(array('model' => 'BugType', 'required' => false)),
      'milestone_id' => new sfValidatorDoctrineChoice(array('model' => 'BugMilestone', 'required' => false)),
      'project_id'   => new sfValidatorDoctrineChoice(array('model' => 'Project')),
      'creator_id'   => new sfValidatorDoctrineChoice(array('model' => 'User', 'required' => false)),
      'owner_id'     => new sfValidatorDoctrineChoice(array('model' => 'User', 'required' => false)),
      'due_date'     => new sfValidatorDate(array('required' => false)),
      'priority_id'  => new sfValidatorDoctrineChoice(array('model' => 'BugPriority', 'required' => false)),
      'status_id'    => new sfValidatorDoctrineChoice(array('model' => 'BugStatus', 'required' => false)),
      'created_at'   => new sfValidatorDateTime(array('required' => false)),
      'updated_at'   => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('bug[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Bug';
  }

}